/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.quality4spl.fm.cvm.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.quality4spl.fm.cvm.CvmPackage;
import org.quality4spl.fm.cvm.FeatureConfiguration;
import org.quality4spl.fm.cvm.FeatureModel;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Feature Configuration</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureConfigurationImpl#getPreviousConfigurationStep <em>Previous Configuration Step</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureConfigurationImpl#getConfiguredFeatureModel <em>Configured Feature Model</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FeatureConfigurationImpl extends ConfigDecisionModelImpl implements FeatureConfiguration {
	/**
	 * The cached value of the '{@link #getPreviousConfigurationStep() <em>Previous Configuration Step</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPreviousConfigurationStep()
	 * @generated
	 * @ordered
	 */
	protected FeatureConfiguration previousConfigurationStep;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FeatureConfigurationImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CvmPackage.Literals.FEATURE_CONFIGURATION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureConfiguration getPreviousConfigurationStep() {
		if (previousConfigurationStep != null && previousConfigurationStep.eIsProxy()) {
			InternalEObject oldPreviousConfigurationStep = (InternalEObject)previousConfigurationStep;
			previousConfigurationStep = (FeatureConfiguration)eResolveProxy(oldPreviousConfigurationStep);
			if (previousConfigurationStep != oldPreviousConfigurationStep) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CvmPackage.FEATURE_CONFIGURATION__PREVIOUS_CONFIGURATION_STEP, oldPreviousConfigurationStep, previousConfigurationStep));
			}
		}
		return previousConfigurationStep;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureConfiguration basicGetPreviousConfigurationStep() {
		return previousConfigurationStep;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPreviousConfigurationStep(FeatureConfiguration newPreviousConfigurationStep) {
		FeatureConfiguration oldPreviousConfigurationStep = previousConfigurationStep;
		previousConfigurationStep = newPreviousConfigurationStep;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE_CONFIGURATION__PREVIOUS_CONFIGURATION_STEP, oldPreviousConfigurationStep, previousConfigurationStep));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureModel getConfiguredFeatureModel() {
		FeatureModel configuredFeatureModel = basicGetConfiguredFeatureModel();
		return configuredFeatureModel != null && configuredFeatureModel.eIsProxy() ? (FeatureModel)eResolveProxy((InternalEObject)configuredFeatureModel) : configuredFeatureModel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureModel basicGetConfiguredFeatureModel() {
		// TODO: implement this method to return the 'Configured Feature Model' reference
		// -> do not perform proxy resolution
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setConfiguredFeatureModel(FeatureModel newConfiguredFeatureModel) {
		// TODO: implement this method to set the 'Configured Feature Model' reference
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CvmPackage.FEATURE_CONFIGURATION__PREVIOUS_CONFIGURATION_STEP:
				if (resolve) return getPreviousConfigurationStep();
				return basicGetPreviousConfigurationStep();
			case CvmPackage.FEATURE_CONFIGURATION__CONFIGURED_FEATURE_MODEL:
				if (resolve) return getConfiguredFeatureModel();
				return basicGetConfiguredFeatureModel();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CvmPackage.FEATURE_CONFIGURATION__PREVIOUS_CONFIGURATION_STEP:
				setPreviousConfigurationStep((FeatureConfiguration)newValue);
				return;
			case CvmPackage.FEATURE_CONFIGURATION__CONFIGURED_FEATURE_MODEL:
				setConfiguredFeatureModel((FeatureModel)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CvmPackage.FEATURE_CONFIGURATION__PREVIOUS_CONFIGURATION_STEP:
				setPreviousConfigurationStep((FeatureConfiguration)null);
				return;
			case CvmPackage.FEATURE_CONFIGURATION__CONFIGURED_FEATURE_MODEL:
				setConfiguredFeatureModel((FeatureModel)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CvmPackage.FEATURE_CONFIGURATION__PREVIOUS_CONFIGURATION_STEP:
				return previousConfigurationStep != null;
			case CvmPackage.FEATURE_CONFIGURATION__CONFIGURED_FEATURE_MODEL:
				return basicGetConfiguredFeatureModel() != null;
		}
		return super.eIsSet(featureID);
	}

} //FeatureConfigurationImpl
